﻿using System;
using Mbs.Configuration;

namespace Mbs
{
    public static partial class ServiceRegistry
    {
        public static IServiceRegistry Current { get; set; }
    }

    /// <summary>
    /// 服务定位器门面类
    /// </summary>
    public static partial class ServiceLocator
    {

        private static IServiceLocator locator;
        public static IServiceLocator Current
        {
            get
            {
                if (locator == null)
                {
                    locator = ServiceLocatorSection.Get();
                    if (locator == null)
                        throw new ArgumentNullException("service locator is null.");
                }
                return locator;
            }
            set
            {

                if (value == null)
                    throw new ArgumentNullException("service locator is null.");
                locator = value; ;
            }
        }
       
    }

}
